*** Replication materiale for: 
*** Did the citizenship income scheme do it? The supposed electoral consequence of a flagship policy
*** Marco Giuliani, RISP/IPSR

ssc install outreg2
ssc install coefplot
ssc install cem


*** Place all files in 'yourdirectory'
cd "C:\yourdirectory"

use "Com01012022_WGS84.dta"
**NB. you should have also the shapefiles in the same directory, and prepare a "Output" subdirectory


***Maps Figure 1
grmap pct2022, ndsize(none) osize(none none none none none none none none none) cln(9)
graph save "Graph" "Output\Fig 1a m5s.gph"

grmap redcit, ndsize(none) osize(none none none none none none none none none) cln(9)
graph save "Graph" "Output\Fig 1b rdc.gph"

graph combine "Output\Fig 1a m5s.gph" "Output\Fig 1b rdc.gph", graphregion(color(white))

graph save "Graph" "Output\Fig 1.gph"


***Regression models

* Table 1
reg pct2022 redcit pct2018 deltaturnout i.area5, cluster(province)
reg pct2022 redcit pct2018 deltaturnout i.numregione, cluster(province)


*** Figure 2

*First normalize dividing for 2sd (Gelman 2008)

foreach var of varlist redcit emp1564-ong {
      sum `var'
	  generate z`var' = `var'/(2*r(sd))
  }
  

*Short labels
label variable zredcit "Citizenship income"
label variable zemp1564 "Employment"
label variable zyouthemp "Youth employment"
label variable zunemp1564 "Unemployment"
label variable zinactive1564 "Inactive"
label variable zneet "Neet"
label variable zeducation "Education"
label variable zformation "Formation"
label variable znewsdiffusion "Newspapers"
label variable znoliteracy "Literacy problem"
label variable znonumeracy "Numeracy problem"
label variable zincomedepwork "Dependent income"
label variable zincomepertaxpayer "Taxable income"
label variable zpcttaxpayersless10000 "Poor taxpayers"
label variable zbankdeposits "Bank deposits"
label variable znonperfloans "Non-performing loans"
label variable zprotest "Protests"
label variable zexport "Export"
label variable zonlineservices "Municipal online"
label variable zlogpop2022 "Population"
label variable zong "ONGs"

"


* Regress

foreach var of varlist zredcit zemp1564-zong {
	quietly regress pct2022 pct2018 deltaturnout `var', cluster(province)
      estimates store `var'_1
  }
  

foreach var of varlist zredcit zemp1564-zong {
	quietly regress pct2022 zredcit pct2018 deltaturnout `var', cluster(province)
      estimates store `var'_2
  }
 
 ***MY TABLE
 cd "C:\yourdirectory\Output"

 
 foreach var of varlist zredcit zemp1564-zong {
	regress pct2022 pct2018 deltaturnout `var', cluster(province)
      outreg2 using "Table a1", word dec(2) append
  }
  

foreach var of varlist zredcit zemp1564-zong {
	regress pct2022 zredcit pct2018 deltaturnout `var', cluster(province)
      outreg2 using "Table a2", word dec(2) append
  }
 
  
* Plot coefficients
		
coefplot (zemp1564_1 zyouthemp_1 zunemp1564_1 zinactive1564_1 zneet_1 zeducation_1 zformation_1 znewsdiffusion_1 znoliteracy_1 znonumeracy_1 zincomedepwork_1 zpcttaxpayersless10000_1 zincomepertaxpayers_1 zbankdeposits_1 znonperfloans_1 zprotest_1 zexport_1 zonlineservices_1 zlogpop2022_1 zong_1, label("") mcolor(navy) ciopts(lcolor(navy))) , bylabel("") keep (zemp1564 zyouthemp zunemp1564 zinactive1564 zneet zeducation zformation znewsdiffusion znoliteracy znonumeracy zincomedepwork zpcttaxpayersless10000 zincomepertaxpayers zbankdeposits znonperfloans zprotest zexport zonlineservices zlogpop2022 zong) ylabel(, labsize(small)) xlabel(, labsize(small)) xline(0, lcolor(red) lp (dash) ) || ///
(zemp1564_2 zyouthemp_2 zunemp1564_2 zinactive1564_2 zneet_2 zeducation_2 zformation_2 znewsdiffusion_2 znoliteracy_2 znonumeracy_2 zincomedepwork_2 zpcttaxpayersless10000_2 zincomepertaxpayers_2 zbankdeposits_2 znonperfloans_2 zprotest_2 zexport_2 zonlineservices_2 zlogpop2022_2 zong_2, label("") mcolor(navy) ciopts(lcolor(navy))) , bylabel("") keep (zredcit zemp1564 zyouthemp zunemp1564 zinactive1564 zneet zeducation zformation znewsdiffusion znoliteracy znonumeracy zincomedepwork zpcttaxpayersless10000 zincomepertaxpayers zbankdeposits znonperfloans zprotest zexport zonlineservices zlogpop2022 zong) ylabel(, labsize(small)) xlabel(, labsize(small)) xline(0, lcolor(red) lp (dash) ) scheme(s2mono)
		

		
*Saturated models		

reg pct2022 pct2018 deltaturnout zemp1564 zyouthemp zunemp1564 zinactive1564 zneet zeducation zformation znewsdiffusion znoliteracy znonumeracy zincomedepwork zpcttaxpayersless10000 zincomepertaxpayers zbankdeposits znonperfloans zprotest zexport zonlineservices zlogpop2022 zong, cluster(province)

reg pct2022 pct2018 deltaturnout zemp1564 zyouthemp zunemp1564 zinactive1564 zneet zeducation zformation znewsdiffusion znoliteracy znonumeracy zincomedepwork zpcttaxpayersless10000 zincomepertaxpayers zbankdeposits znonperfloans zprotest zexport zonlineservices zlogpop2022 zong redcit, cluster(province)
		

		
***CEM Table A.6
imb emp1564 unemp1564 youthemp inactive neet nonumeracy noliteracy pcttaxpayersless10000 nonperfloans , treatment( redcitdichmed )

cem emp1564 unemp1564 youthemp inactive neet nonumeracy noliteracy pcttaxpayersless10000 nonperfloans , treatment( redcitdichmed )

*Table 2
reg pct2022 redcit pct2018 deltaturnout [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout i.area5 [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout i.numregione [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout emp1564 unemp1564 youthemp inactive neet nonumeracy noliteracy pcttaxpayersless10000 nonperfloans education formation newsdiffusion incomedepwork incomepertaxpayer bankdeposits protest export onlineservices logpop2022 ong [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout i.numregione emp1564 unemp1564 youthemp inactive neet nonumeracy noliteracy pcttaxpayersless10000 nonperfloans education formation newsdiffusion incomedepwork incomepertaxpayer bankdeposits protest export onlineservices logpop2022 ong [iweight= cem_weights], cluster(province)
*Appendix


* Tab. A.1 Descriptive statistics		

sum redcit pct2022 deltaturnout emp1564 youthemp unemp1564 inactive1564 neet education formation newsdiffusion noliteracy nonumeracy incomedepwork pcttaxpayersless10000 incomepertaxpayers bankdeposits nonperfloans protest export onlineservices logpop2022 ong
		
		
* Tab A.2 Matrix of correlation

pwcorr pct2022 zredcit zemp1564 zyouthemp zunemp1564 zinactive1564 zneet zeducation zformation znewsdiffusion znoliteracy znonumeracy zincomedepwork zpcttaxpayersless10000 zincomepertaxpayers zbankdeposits znonperfloans zprotest zexport zonlineservices zlogpop2022 zong, print(5) star(1)



* Figure A.1

grmap pct2018, ndsize(none) osize(none none none none none none none none none) clm (c) clbreaks(0 5 10 15 20 30 40 50 100)
grmap pct2022, ndsize(none) osize(none none none none none none none none none) clm (c) clbreaks(0 5 10 15 20 30 40 50 100)



* Regress


foreach var of varlist zredcit zemp1564-zong {
	regress pct2022 pct2018 deltaturnout zredcit `var' [iweight= cem_weights], cluster(province)
      estimates store `var'_4
  }
  
* Plot coefficients Figure A.3
		
coefplot zemp1564_4 zyouthemp_4 zunemp1564_4 zinactive1564_4 zneet_4 zeducation_4 zformation_4 znewsdiffusion_4 znoliteracy_4 znonumeracy_4 zincomedepwork_4 zpcttaxpayersless10000_4 zincomepertaxpayers_4 zbankdeposits_4 znonperfloans_4 zprotest_4 zexport_4 zonlineservices_4 zlogpop2022_4 zong_4, keep (zredcit) xline(0) ylabel(, labsize(small)) xlabel(, labsize(small)) xline(0, lcolor(red) lp (dash) )

		
*Robust

* Table A.7
 
reg pct2022 pct2018 deltaturnout redcit if area5==1, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(North-West) dec(2)
reg pct2022 pct2018 deltaturnout redcit if area5==2, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(North-East) dec(2)
reg pct2022 pct2018 deltaturnout redcit if area5==3, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(ex-Red zone) dec(2)
reg pct2022 pct2018 deltaturnout redcit if area5==4, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(Center) dec(2)
reg pct2022 pct2018 deltaturnout redcit if area5==5, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(South) dec(2)
reg pct2022 pct2018 deltaturnout redcit i.COD_REG, cluster(province)
outreg2 using ctrlreg.doc, append ctitle(Regional dummies) dec(2)


* Table A.8

reg pct2022 redcit pct2018 deltaturnout emp1564 youthemp unemp1564 inactive neet noliteracy nonumeracy pcttaxpayersless10000 nonperfloans [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout education formation newsdiffusion incomedepwork incomepertaxpayer bankdeposits protest export onlineservices logpop2022 ong [iweight= cem_weights], cluster(province)

reg pct2022 redcit pct2018 deltaturnout emp1564 unemp1564 youthemp inactive neet nonumeracy noliteracy pcttaxpayersless10000 nonperfloans education formation newsdiffusion incomedepwork incomepertaxpayer bankdeposits protest export onlineservices logpop2022 ong [iweight= cem_weights], cluster(province)


